package es.javamyadmin.modelo;

import java.util.Collection;

import es.javamyadmin.dao.DatabasesDAO;
import es.javamyadmin.dao.TablesDAO;
import es.javamyadmin.dao.UsuariosDAO;

public class ModelFacade {
		
	/*MOSTRAR BASES DE DATOS*/
	public static Collection<Databases> getDatabase(String user, String pass, String host, String port){
		
		DatabasesDAO datadao = new DatabasesDAO();
		
		Collection<Databases> databases = datadao.leerDatabases(user, pass, host, port);
		
		return databases;
	}
	
	
	/*MOSTRAR TABLAS DE UNA BASES DE DATOS*/
	public static Collection<Tables> getTables(String user, String pass, String host, String port, String database){
		
		TablesDAO tabledao = new TablesDAO();
		
		Collection<Tables> tables = tabledao.leerTables(user, pass, host, port, database);
		
		return tables;
	}
	
	/*MOSTRAR NUMERO DE FILAS DE UNA TABLA*/
	public static Collection<Tables> getNumFilasTables(String user, String pass, String host, String port, String database, String table){
		
		TablesDAO tabledao = new TablesDAO();
		
		Collection<Tables> tables = tabledao.leerNumFilasTables(user, pass, host, port, database, table);
		
		return tables;
	}
	
	/*OBTENER USUARIOS MYSQL*/
	public static Collection<Usuarios> getUsuarios(String user, String pass, String host, String port, String clausulaWhere){
		
		UsuariosDAO usuariosdao = new UsuariosDAO();
		
		Collection<Usuarios> usuarios = usuariosdao.leerUsuarios(user, pass, host, port, clausulaWhere);
		
		return usuarios;
	}
	
	//String user, String pass, String host, String port, String database, String tabla
		public static Collection<Tables> getDescribe(String user, String pass, String host, String port, String database, String table){
			
			TablesDAO tabledao = new TablesDAO();
			
			Collection<Tables> tables = tabledao.detalleTables(user, pass, host, port, database, table);
			
			return tables;
		}
		
		public static Collection<Tables> getSelect(String user, String pass, String host, String port, String database, String table){
			TablesDAO tabledao = new TablesDAO();
			Collection<Tables> select = tabledao.selecTables(user, pass, host, port, database, table);
			System.out.println("Entro en model facade");
			return select;
		}
	
}
